package com.byx.imserverutil.entity;

import io.netty.channel.Channel;

/**
 * NettyChannel
 *
 * @author Superb
 * @date 2021/2/20 21:12
 */
public class NettyChannel {
    private String userId;
    private Channel channel;

    public NettyChannel(String userId, Channel channel) {
        this.userId = userId;
        this.channel = channel;
    }

    public String getUserId() {
        return userId;
    }

    public Channel getChannel() {
        return channel;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setChannel(Channel channel) {
        this.channel = channel;
    }

    public String getChannelId(){
        return channel.id().toString();
    }

    public boolean isActive(){
        return channel.isActive();
    }

    @Override
    public String toString() {
        return "NettyChannel{" +
                "userId=" + userId +
                ", channel=" + channel +
                '}';
    }
}
